﻿using oceanho.webapi.factory.httpEntity;
using System;
using System.Collections.Generic;
using System.Text;

namespace oceanho.webapi.factory.httpCore
{
    /// <summary>
    /// 定义一个标识某个上传文件对象UploadItem开始上传的委托
    /// </summary>
    /// <param name="upload">上传文件完成对象UploadItem</param>
    public delegate void UploadItemStart(UploadItem upload);

    /// <summary>
    /// 定义一个标识某个上传文件对象UploadItem完成上传的委托
    /// </summary>
    /// <param name="upload">上传文件完成对象UploadItem</param>
    public delegate void UploadItemCompleted(UploadItem upload);

    /// <summary>
    /// 定义一个标识某个上传文件对象UploadItem引发异常的委托
    /// </summary>
    /// <param name="upload">上传文件完成对象UploadItem<</param>
    /// <param name="fail">异常信息</param>
    public delegate void UploadItemFailedHandler(UploadItem upload, Exception fail);

    /// <summary>
    /// 定义一个标识某个上传文件对象UploadItem文件类型不合法的委托
    /// </summary>
    /// <param name="upload">上传文件完成对象UploadItem</param>
    /// <param name="validOption">FileUploadTypeValidOption验证选项</param>
    public delegate bool UploadItemValidFailed(UploadItem upload, FileUploadTypeValidOption validOption);

    /// <summary>
    /// 定义一个标识某个上传文件对象UploadItem进行发生改变的委托
    /// </summary>
    /// <param name="upload">上传文件完成对象UploadItem</param>
    /// <param name="progress">当前完成的进度（单位：字节）</param>
    public delegate void UploadItemProgressChange(UploadItem upload, long progress);
}
